added Feb 2001 SDK
[windows-sources.git] / shared source / vb / language / shared / unicode.h
blob0920d990bc045439a271dbbda02dcf5d2f4e459b
1 //-------------------------------------------------------------------------------------------------
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // This module provides wrappers that simulate unicode API's on Win95.
6 //
7 //-------------------------------------------------------------------------------------------------
9 #pragma once
11 /*****************************************************************************/
12 // @@ fullwidth/halfwidth conversion macros
14 // MAKEFULLWIDTH - Converts a half-width to full-width character
16 #define MAKEFULLWIDTH(c) (((c) < 0x0021 || (c) > 0x007E) ? (c) : ((c) + 0xFF00 - 0x0020))
18 // MAKEHALFWIDTH - Converts a full-width character to half-width
19 #define MAKEHALFWIDTH(c) (((c) < 0xFF01 || (c) > 0xFF5E) ? (c) : ((c) - 0xFF00 + 0x0020))
21 // ISFULLWIDTH - Returns if the character is full width
22 #define ISFULLWIDTH(c) ((c) > 0xFF00 && (c) < 0xFF5F)
24 #if ID_TEST
26 /*****************************************************************************/
27 // @@ Unicode/Ansi string conversion functions
28 // - WIDESTR(sz) - converts an ANSI string to unicode on the stack
29 // - ANSISTR(wsz) - converts a unicode string to ANSI on the stack
30 // - WszCpyToSz(sz, wsz) - copy a unicode string into an ansi buffer
31 // - SzCpyToWsz(wsz, sz) - copy an ANSI string to unicode buffer
32 // Be care of using the WIDESTR and ANSISTR macros inside of a loop, since
33 // each invocation causes stack allocation. If you need to perform
34 // ANSI / Unicode version within a loop, use WszCpyToSz or SzCpyToWsz
36 char * WszCpyToSz(
37 _Out_z_cap_x_(strlen(wszSrc)+ 1)char * szDest,
38 _In_z_ const WCHAR * wszSrc);
40 WCHAR * SzCpyToWsz(
41 _Out_z_cap_x_((strlen(szSrc)+ 1)* sizeof(WCHAR))WCHAR * wszDest,
42 _In_z_ const char * szSrc);
44 #endif
46 /*****************************************************************************/
47 // @@ Unicode string compare functions.
48 // - WszEqNoCase - case insensitive, default lcid, compare entire string
49 // - WszEqLenNoCase - case insensitive, default lcid,
51 bool WszEqNoCase(
52 _In_z_ const WCHAR * wsz1,
53 _In_z_ const WCHAR * wsz2);
55 bool WszEqLenNoCase(
56 _In_count_(cch)const WCHAR * wsz1,
57 int cch,
58 _In_z_ const WCHAR * wsz2);
60 /*****************************************************************************/
61 // @@ Unicode string conversion functions.
62 // - BinaryToUnicode - converts binary stream into hex-encoded string
64 void BinaryToUnicode(
65 BYTE * pbSrc,
66 UINT cbSrc,
67 _Out_z_cap_x_(" At least cbSrc ")LPWSTR pwszDst);